<template>
    <div>
        <!-- 卡片一：扫二维码 -->
        <div class="card bg-light mt-3">
            <div class="card-body d-flex">
                <img :src="params.weixin_url" width="120px" alt="">
                <div class="ms-5">
                    <p>&bull; 技术干货分享</p>
                    <p>&bull; 免费资料领取</p>
                    <p class="fw-bolder">&bull; 扫码领取更多惊喜</p>
                </div>
            </div>
        </div>

        <!-- 卡片二：联系方式 -->
        <div class="card bg-light mt-3">
            <div class="card-body">
                <h5>社交</h5>
                <hr />
                <p>QQ: {{ params.qq}}</p>
                <p>邮箱: {{ params.email}}</p>
            </div>
        </div>

        <!-- 广告图 -->
        <img class="mt-3" :src="params.ad_url" alt="" style="height: 130px; width: 100%;">

        <!-- 卡片三：文章分类 -->
        <div class="card bg-light mt-3">
            <div class="card-body">
                <h5>分类</h5>
                <hr />
                <p v-for="a in articleTypes">
                    <a :href="'blog-classify.html?' + a.typeId" class="card-link text-decoration-none text-primary">
                      {{ a.typeName }} <span style="color: gray">({{a.sum}})</span>
                    </a>
                </p>

            </div>
        </div>

        <!-- 卡片四：归档 -->
        <div class="card bg-light mt-3">
            <div class="card-body">
                <h5>归档</h5>
                <hr />
                <p v-for="t in timecount">
                    <a href="#" class="card-link text-decoration-none text-primary">
                      {{ t.time }} <span style="color: gray">({{ t.count }})</span>
                    </a>
                </p>
            </div>
        </div>
    </div>
</template>

<script>
module.exports = {
    data() {
      return{
        articleTypes:[],
        timecount:[],
        params:[]
      }
    },
    methods: {
      //获取统计文章类型
      getArticleType(){
        this.$http.get("/article/articleType").then(res =>{
          this.articleTypes = res.data
        })
      },

      //获取时间统计
      gettimecount(){
        this.$http.get("/article/timeCount").then(res =>{
          this.timecount = res.data
        })
      },

      //侧边栏展示数据
      getparams(){
        this.$http.get("/param/getParams").then(res =>{
          this.params = res.data
        })
      }

    },
    mounted() {
      this.getparams();
      this.getArticleType();
      this.gettimecount();
    },
}
</script>

<style></style>